package com.aaa.reflect;

import com.aaa.ann.ColunmAnn;
import com.aaa.ann.MyAnn;
import com.aaa.ann.TableAnn;

import java.io.Serializable;

/**
 * @author ：Teacher陈（86521760@qq.com）
 * @date ：Created in 2022/8/18 9:02
 * @description：
 * @modified By：
 * @version:
 */

@TableAnn(tableName = "tbl_person")
//将实体类跟table进行关联
public class Person    implements Serializable {

    @ColunmAnn(colName = "person_id")
    public int id;
    @ColunmAnn(colName = "person_name")
    private String name;
    @ColunmAnn(colName = "person_age")
    private int age;

    private   void introduce(){
        System.out.println("我是"+name);
    }
    public   void introduce2(){
        System.out.println("我是"+name);
    }
    public   void add(int a,int b){
        System.out.println(a+b);
    }
    public   int add2(int a,int b){
       return a+b;
    }
    public Person() {
        System.out.println("无参的构造器执行了");
    }

    public Person(int id, String name, int age) {
        System.out.println("全部参数的构造器执行了");
        this.id = id;
        this.name = name;
        this.age = age;
    }

    public Person(int id) {
        System.out.println("1个参数的构造器执行了");
        this.id = id;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public static void main(String[] args) {
        Person p1= new Person();
        try {
            Object clone = p1.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
    }


    @Override
    public String toString() {
        return "Person{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}
